package ${packageName};

import java.util.List;

import org.springframework.transaction.annotation.Transactional;
import org.support.mybatis.page.Page;
import org.support.mybatis.page.PageHelper;

import ${MODEL_URL};

/**
 * @author ${annotation.authorName}(${annotation.authorMail})<br>
 * @date ${annotation.date}
 * 
 * @version ${annotation.version}
 */
public interface ${servicePrefix}${className}${classSuffix} {


	<#list colList as col>
    <#if col.isPK==1>
     /**
     *
     * 插入数据
     * @param ${classNameLower}
     * @return 影响数
     **/
    @Transactional
    public ${col.simpleFieldType} save(${className} ${classNameLower});
    </#if>
    </#list>
    
    <#list colList as col>
    <#if col.isPK==1>
    /**
     * 删除通过主键
     * @param ${col.columnName} ${col.remarks}
     * @return 影响数
     **/
    @Transactional
    public int deleteByPrimaryKey(${col.simpleFieldType} ${col.columnName});
    </#if>
    </#list>
    
    <#list colList as col>
    <#if col.isPK==1>
    /**
     * 更新不为空的字段通过主键
     * @param ${classNameLower}
     * @return 影响数
     **/
    @Transactional
    public int updateByPrimaryKey(${className} ${classNameLower});
    </#if>
    </#list>
    
    <#list colList as col>
    <#if col.isPK==1>
    /**
     * 查询通过主键
     * @param ${col.columnName} ${col.remarks}
     * @return 影响数
     **/
    public ${className} selectByPrimaryKey(${col.simpleFieldType} ${col.columnName});
    </#if>
    </#list>
    
   /**
     *
     * 查找所有
     * @author 66
     * @return
     **/
    public List<${className}> query${className}All(); 
    
    /**
	 * 查询通过分页
	 * @param helper
	 * @return
	 */
    public Page<${className}> query${className}ByPage(PageHelper helper,${className} param);
    
    <#list idxList as idx>
	/**
     * 根据索引查询
     * @author 66
     <#list idx.colList as idxCol>
     * @param  ${idxCol.columnName} ${idxCol.remarks}
     </#list>
     * @return 集合
     **/
    public List<${className}> query${className}By${idx.idxName}(<#list idx.colList as idxCol><#if idxCol_has_next>${idxCol.simpleFieldType} ${idxCol.columnName},<#else>${idxCol.simpleFieldType} ${idxCol.columnName}</#if></#list>);
	</#list>
}